# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Andrey Vihrov <andrey.vihrov at gmail.com>
# Contributor: James An <james@jamesan.ca>
# Contributor: Michael Fellinger <m.fellinger@gmail.com>

pkgname=libtomcrypt
pkgver=1.18.2
pkgrel=1
pkgdesc="A fairly comprehensive, modular and portable cryptographic toolkit"
arch=('x86_64')
url="https://www.libtom.net/LibTomCrypt/"
license=('custom:PublicDomain')
depends=('libtommath' 'gmp')
source=("https://github.com/libtom/$pkgname/releases/download/v$pkgver/${pkgname#libtom}-$pkgver.tar.xz"{,.asc})
sha256sums=('96ad4c3b8336050993c5bc2cf6c057484f2b0f9f763448151567fbab5e767b84'
            'SKIP')
validpgpkeys=('C4386A237ED43A475541B9427B2CD0DD4BCFF59B') # Steffen Jaeckel <s_jaeckel@gmx.de>

build() {
  cd $pkgname-$pkgver

  export CPPFLAGS+=" -DLTM_DESC -DGMP_DESC -DUSE_LTM"
  export EXTRALIBS="-ltommath -lgmp"
  make -f makefile.shared IGNORE_SPEED=1 library test
}

check() {
  cd $pkgname-$pkgver
  ./test
}

package() {
  cd $pkgname-$pkgver

  make -f makefile.shared DESTDIR="$pkgdir" PREFIX="/usr" INSTALL_GROUP="root" INSTALL_OPTS="" install

  install -Dm 644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

# vim:set ts=2 sw=2 et:
